<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: application_top_callback.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

error_reporting(E_ALL & ~E_NOTICE);

if(file_exists('includes/local/configure.php') && filesize('includes/local/configure.php') > 0)
	include('includes/local/configure.php');
elseif(file_exists('includes/configure.php') && filesize('includes/configure.php') > 0)
	include('includes/configure.php');
elseif(!defined('MERCARI_INSTALLED')) {
	header('Location: installer/');
	exit;
} else {
	header('Location: installer/');
	exit;
}

date_default_timezone_set('Europe/Berlin');

$request_type = (getenv('HTTPS') == '1' || getenv('HTTPS') == 'on' || !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) ? 'SSL' : 'NONSSL';

if(empty($PHP_SELF))
	$PHP_SELF = basename($_SERVER['PHP_SELF']);

require(DIR_WS_INCLUDES.'filenames.php');
require(DIR_WS_INCLUDES.'database_tables.php');
include(DIR_WS_INCLUDES.'functions.php');

function __autoload($class_name) {
    require_once(DIR_WS_CLASSES.'class.'.$class_name.'.php');
}

$db = new mercari_db();

$configuration = $db->db_query("SELECT configuration_key, configuration_value FROM ".TABLE_CONFIGURATION);
while(!$configuration->EOF) {
	define($configuration->fields['configuration_key'], $configuration->fields['configuration_value']);
	$configuration->MoveNext();
}

if((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib'))) {
	if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1)
		ob_start('ob_gzhandler');
	else
		ini_set('zlib.output_compression_level', GZIP_LEVEL);
} else
	ob_start();

$SESS_LIFE = 3600;
$session = new sessions;
$session->_sess_start();
include(DIR_WS_FUNCTIONS.'tracking.php');
$session_started = true;
?>